{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "is_executing": true
    },
    "ExecuteTime": {
     "start_time": "2025-09-11T08:44:19.908252Z"
    }
   },
   "source": [
    "# 匿名函数\n",
    "# l = [(1, 20), (3, 0), (9, 10), (2, -1)]\n",
    "# l.sort(key = lambda x: x[1])\n",
    "# print(l)\n",
    "from tkinter import Button, mainloop\n",
    "button = Button(\n",
    "    text='This is a button',\n",
    "    command=lambda: print('being pressed')) # 点击时调用lambda函数\n",
    "button.pack()\n",
    "mainloop()"
   ],
   "outputs": [],
   "execution_count": null
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
